﻿<%@ page language="java" import="com.jkxt.model.*"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人健康档案系统</title>
    <link rel="stylesheet" href="<%=basePath %>css/index.css"/>
    <script type="text/javascript" src="<%=basePath %>umeditor/third-party/jquery.min.js"></script>
    <script type="text/javascript">
       var isFass=false;
       var isPassword=false;
       var isRePassword=false;
       
       function checkOldPassword(){
                   var oldPassword=$("#oldPassword").val();
                    $.ajax( {  
                        type : "post",  
                        url : "<%=basePath %>index/checkPassword.do",  
                        data : "oldPassword="+oldPassword,  
                        dataType: "text",  
                        success : function(msg) {  
                            if(msg=="success"){
                               isFass=true;
                               $("#message").html("");
                            }else{
                                isFass=false;
                                $("#message").html("旧密码验证错误!");
                            }  
                        }  
                    });
       }
       
       function checkPassword(){
          if($("#password").val().length > 5){
              isPassword=true;
              $("#message").html("");
          }else{
              isPassword=false;
              $("#message").html("新密码少于6位!");
          }
       }
       
       function checkRePassword(){
          if($("#rePassword").val().length > 5){
              isRePassword=true;
              $("#message").html("");
          }else{
              isRePassword=false;
              $("#message").html("新密码少于6位!");
          }
       }
       
       function checkSubmit(){
            if(isFass ==false){
                $("#message").html("旧密码验证错误!");
                return false;
            }
            
            if(isPassword==false){
               $("#message").html("新密码少于6位!");
               return false;
            }
            
            if(isRePassword==false){
               $("#message").html("新密码少于6位!");
               return false;
            }
            
            if($("#password").val()!=$("#rePassword").val()){
                $("#message").html("新密码不一致");
               return false;
            }
            
            return true;
       }

    </script>
</head>
<body>
<!-- 全站公用主导航  -->
<div class="sw-hd">
  <div class="sw-top">
    <div class="layout">
      <div class="sw-top-logo">
        <h1 class="seo">个人健康系统</h1>
        <a href="<%=basePath%>index/list.do">个人健康系统</a> </div>
      <div class="sw-top-slogan"><a href="#"><img src=""></a></div>
				<div class="sw-top-se">
					<form name="formsearch" action="<%=basePath%>index/list.do" id="global_search_form" method="post">
						 <input name="title"
							class="sw-input" autocomplete="off" placeholder="档案号搜索："
							maxlength="60"> <input type="submit" class="sw-input-btn"
							value="搜索">
					</form>
				</div>
    </div>
  </div>
  <div class="sw-nav">
    <div class="layout">
      <div class="sw-nav fleft">
        <ul>
          <li><a href="<%=basePath%>index/list.do">健康信息</a></li>
          <li><a href="<%=basePath%>index/record.do">记录健康信息</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!--全站公用主导航 END -->


<div class="sw-main clearfix">
  <!-- 面包屑 START -->
  <!-- 面包屑 START -->
<div class="sw-crumb clearfix mb15">
  <ul class="fleft">
    <li><em>当前位置：</em> <a href='<%=basePath%>index/toUpdatePassword.do'>修改密码</a></li>
  </ul>
</div>
<!-- 面包屑 END -->
  <!-- 面包屑 END -->
  <!-- 左侧容器 START -->
  <div class="sw-w960 fleft">
    <div class="sw-modBox sw-excerpt">
     <form action="<%=basePath%>index/updateUserPassword.do" method="post" onsubmit="return checkSubmit()">
       <span style=" color: red;font-size: 12px;" id="message">${message}</span><br/>
       <span>用户名： ${user.name}</span><br/>
       <span>请输入旧密码：</span><input class="intro_input" type="password" name="oldPassword" id="oldPassword" value="" onblur="checkOldPassword()"/><br/>
       <span>请输入新密码：</span><input class="intro_input" type="password" name="password" id="password" value="" onblur="checkPassword()"/><span style=" color: red;font-size: 12px;" id="message">密码大于6位</span><br/>
       <span>请重新输入密码：</span><input class="intro_input" type="password" name="rePassword" id="rePassword" value="" onblur="checkRePassword()"/><br/>
       <br/>
       <div class="intro_submit">
         <input type="submit"  value="保存并返回" >
       </div>
       <br/>
      </form>
    </div>
  </div>
</div>
<!-- 页尾 START -->
<div class="f_menu clearfix"></div>
<div class="copright">
  <a target='_blank' href='http://www.jyzhz.com/'>惠州市金燕子科技有限公司</a>版权所有
</div>
</body>
</html>